//
// request_parser.cpp
// ~~~~~~~~~~~~~~~~~~
//

#include "request_parser.hpp"
#include "request.hpp"

namespace http {
    namespace server3 {

request_parser::request_parser()
    : state_(method_start)
{
    //buf = (char*)malloc(MAX_REQUEST_SIZE);
    ptr = buf;
}
request_parser::~request_parser()
{
   //free(buf);
}

void request_parser::reset()
{
    state_ = method_start;
}


bool request_parser::is_char(char c)
{
  //return c >= 0 && c <= 127;
  return ~(c >>7);
}


bool request_parser::is_tspecial(char c)
{

  switch (c)
  {
  case '(': case ')': case '<': case '>': case '@':
  case ',': case ';': case ':': case '\\': case '"':
  case '/': case '[': case ']': case '?': case '=':
  case '{': case '}': case ' ': case '\t':
    return true;
  default:
    return false;
  }
  // NO. They are not punctuations.
    //return ispunct(c);
}


    } // namespace server3
} // namespace http
